Skip to content
This repository has been archived by the owner on Aug 5, 2021. It is now read-only.

Maven generates an auto installable jar with C libraries embedded. #78

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pabloa
Copy link

@pabloa pabloa commented Dec 23, 2016

Only tested on Linux.
When jpy is invoked from the JVM, C libraries are extracted to the
temporal directory and jpy library is initialized.
Therefore there is not need to install JPY by compiling jpy sources.
It is enough to use the generated jar file.

Only tested on Linux.
When jpy is invoked from the JVM, C libraries are extracted to the
temporal directory and jpy library is initialized.
Therefore there is not need to install JPY by compiling jpy sources.
It is enough to use the generated jar file.
@forman
Copy link
Member

forman commented Mar 8, 2017

@pabloa nice work! Could you meanwhile test on other platforms? (We urgently need Travis/AppVeyor support.)

@pabloa
Copy link
Author

pabloa commented Mar 8, 2017

Hello,
Loading c libraries from jar file works on MacOS. I do not have a windows box to test though.If it fails (in any operating system), the old mechanism to load binary files is used. Therefore it should not be intrusive.

Regarding to the jar generation with the compiled C modules embebbed, it should work in the 3 OS because maven is instructed to include .so and .dll files. But again, no windows box to test it.
Pablo

OutputStream output = null;
byte[] buffer = new byte[8 * 1024];
try {
filename = new File(System.getProperty("java.io.tmpdir"), "jpy-" + randomInt);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is still a risk that this line overwrites an existing file. A safer alternative would be to delete randomInt and use File.createTempFile("jpy-", ".so") (or ."dll") instead.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants